package com.mdz.nc.Controller;


import com.mdz.nc.Entity.Sbsjb;
import com.mdz.nc.Mapper.SbsjbMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.time.LocalDate;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 孟德志
 * @since 2020-05-23
 */
@Controller
@RequestMapping("/nc/sbsjb")
public class SbsjbController {
    @Autowired
    private SbsjbMapper sbsjbMapper;

    @ResponseBody
    @RequestMapping(value = "/insertshenji", method = RequestMethod.POST)
    public int insertshenji(Sbsjb sbsjb) {
        LocalDate today = LocalDate.now();
        String[] sjshoum = sbsjb.getSjshuom().split(",");
        sbsjb.setSjrq(today);
        sbsjb.setSjshuom(sbsjb.getSbbh()+"设备,内存大小由"+sjshoum[0]+"升级为"+sjshoum[1]);
        return sbsjbMapper.insert(sbsjb);
    }
}

